#pragma once
#include <QObject>
#include <QMutex>
#include "HiFileTransfer.h"

class HiFileTransferManager : public QObject
{
    Q_OBJECT
protected:
    explicit HiFileTransferManager(QObject* parent = nullptr);
    ~HiFileTransferManager();

public:
    static HiFileTransferManager* getInstance();

public:
    HiFileTransfer* addFileTransfer(const QString& name);
    void removeFileTransfer(const QString& name);
    HiFileTransfer* getFileTransfer(const QString& name) const;
    QList<HiFileTransfer*> getFileTransferList() const;
    QMap<QString, HiFileTransfer*>::const_iterator getFileTransferMapIter() const;

private:
    QMap<QString, HiFileTransfer*> mFileTransferMap;

    static QMutex mMutex;
    static HiFileTransferManager* mInstance;
};

HiFileTransferManager* getFileTransferManager();